package java基础.method;

/**
 * @author IT_Jay
 * @date 2022/1/16 11:06
 */

public class Demo06 {
    //阶乘  4！=4*3*2*1
    //掌握递归的思想
    public static void main(String[] args) {
        System.out.println(f(5));
        System.out.println(f(1));
        System.out.println(f(150));
    }

    public static double f(double n){
        if (n==1) return 1;
        else {
            return n * f(n-1);
        }
    }
}
